<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>二代证测试工具</title>
    <script type="text/javascript" src="../ocx/IdCard.js"></script>
</head>
<div>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="打开设备"
           onclick="openDeviceByIdCard()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="初始化"
           onclick="initDeviceByIdCard()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="获取设备信息"
           onclick="getDevStatusByIdCard()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="读取信息"
           onclick="readIDCardByIdCard()"/>

    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="取消读取"
           onclick="cancelReadIDCardByIdCard()"/>

    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="扫描正反面"
           onclick="scanIDCardByIdCard()"/>

    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="退证"
           onclick="ejectCardByIdCard()"/>
    <input type="button"
           style="color:white;
       width:100px;
       height:50px;
       background-color:#6495ed"
           value="关闭设备"
           onclick="closeDeviceByIdCard()"/>
</div>
<div>
    <input id="result"
           type="text"
           style="width:90%;height:50px;
           margin-top:30px;
           margin-right:50px"
           readonly="readonly"/>
</div>
<object
               id="GGIDCard"
               classid="CLSID:E5BBF1CD-E916-4764-9C82-0B3D7777BC8C"
               name="IdCardJs">
     
</object>

<script>
    function openDeviceByIdCard() {
        var ret = openIDCardDevice()
        document.getElementById("result").value = ret;
    }

    function initDeviceByIdCard() {
        var ret = initIDCardDevice()
        document.getElementById("result").value = ret;
    }

    function getDevStatusByIdCard() {
        var ret = getDeviceStatus()
        document.getElementById("result").value = ret;
    }

    function readIDCardByIdCard() {
        var ret = readCard()
    }

    function cancelReadIDCardByIdCard() {
        var ret = cancelReadCard()
    }

    function scanIDCardByIdCard() {
        var ret = scanIDCard()
    }

    function ejectCardByIdCard() {
        var ret = ejectcard()
        document.getElementById("result").value = ret;
    }

    function closeDeviceByIdCard() {
        var ret = closeDevice()
        document.getElementById("result").value = ret;
    }
</script>

<script for=GGIDCard event=OnReadIDCardCompleted language="JavaScript">
    document.getElementById("result").value = GGIDCard.Name + "|"
        + GGIDCard.Sex + "|"
        + GGIDCard.Nation + "|"
        + GGIDCard.Birthday + "|"
        + GGIDCard.Address + "|"
        + GGIDCard.ID + "|"
        + GGIDCard.Department + "|"
        + GGIDCard.Timelimit + "|"
        + GGIDCard.Image;
</script>

<script for=GGIDCard event=OnUserCanceled language="JavaScript">
    document.getElementById("result").value = "取消读证";
</script>

<script for=GGIDCard event=OnTimeOut language="JavaScript">
    document.getElementById("result").value = "读取超时";
</script>

<script for=GGIDCard event=OnReadIDCardError language="JavaScript">
    document.getElementById("result").value = "读卡异常";
</script>

<script for=GGIDCard event=OnCardRetained language="JavaScript">
    document.getElementById("result").value = "退证以后，未拿走身份证";
</script>

<script for=GGIDCard event=OnCardTaken language="JavaScript">
    document.getElementById("result").value = "已经拿走身份证";
</script>
</html>